package com.quzi.kettle.json;

import org.json.JSONException;
import org.json.JSONObject;

public class JsonUtils {

	public JsonUtils() {

	}
	
	
	
	
	

	/**
	 * 
	 * @param key
	 * @param JsonString
	 * @return
	 */
	public static Person getPerson(String key, String JsonString) {
		Person person = new Person();

		try {
			String s = JsonString;
			JSONObject json = new JSONObject(s);
			person.setMessage((json.getString("message")));
			person.setCode(json.getInt("code"));

			JSONObject data = json.getJSONObject("data");

			person.setSchool(data.getString("school"));
			person.setIs_complete(data.getBoolean("is_complete"));
			person.setUuid(data.getString("uuid"));
			person.setWeight(data.getDouble("weight"));
			person.setNick_name(data.getString("nick_name"));
			person.setEmail(data.getString("email"));
			person.setHeight(data.getDouble("height"));
			person.setRecord(data.getString("record"));
			person.setBirthday(data.getString("birthday"));
			person.setGendar(data.getString("gendar"));
			person.setId(data.getInt("id"));
			person.setIdentity(data.getInt("identity"));

		} catch (JSONException e) {
			e.printStackTrace();
		}

		return person;
	}

}
